function f_get_sql_file()
{
    #获取业务提交的sql, 如果指定的host是localhost, 且指定的文件存在, 则选用本地的sql 文件, 主要用户本地操作, 但是要求文件命名一致, 如下两种命名
    #alter_table_dbname_port_timestamp
    #create_table_dbname_port_timestamp
    declare fun_name
    fun_name="f_get_sql_file"

    if [ "${mode_opt}x" == "crontab_dropx" ] || [ "$(grep -wci "${mode_opt}" <<< "${value_of_task_opt[@]}")x" == "1x" ] || [ "${mode_opt}x" == "crontab_taskx" ]
    then
        return 0
    fi

    if [ "${src_host}x" == "localhostx" ] && [ -f "${sql_file}" ]
    then
        cp ${sql_file} ${sql_file_dir} && exe_state="${?}" || exe_state="${?}"
        sql_file="$(awk -F/ '{print $NF}' <<< "${sql_file}")"
        sql_file="${sql_file_dir}/${sql_file}"
        print_color="1"
    elif [ -n "${src_host}" ]
    then
        server_sql_file="${sql_file}"
        sql_file="$(awk -F/ '{print $NF}' <<< "${sql_file}")"
        sql_file="${sql_file_dir}/${sql_file}"
        #通过rsync从源端机器拉取sql文件
        f_logging "$(eval echo ${log_addr}):REMAIND" "开始从 '${src_host}:/${server_sql_file}'拉sql文件 ]"|tee -a ${log_file}
        __="重试从 '${src_host}:/${server_sql_file}'拉sql文件"
        for ((i=0; i<10; i++))
        do  #添加重试机制, 有时候会出现拉取文件失败, 报文件不存在, 一直找不到原因就添加重试机制吧, 尝试重试10次, 失败就sleep 1秒
            [ "${i}x" != "0x" ] && f_logging "$(eval echo ${log_addr}):REMAIND" "${__}"|tee -a ${log_file}
            rsync  --timeout=5 ${src_host}:/${server_sql_file} ${sql_file_dir} && exe_state="${?}" || exe_state="${?}"
            [ ${exe_state} -ne 0 ] && sleep 1 || break
        done
        f_logging "$(eval echo ${log_addr}):INFO" "拉取sql文件任务结束"|tee -a ${log_file}
    elif [ -z "${clear_table_list}" ]
    then
        f_logging "$(eval echo ${log_addr}):REMAIND" "-h 是必选参数"|tee -a ${log_file}
        f_usage
    else
        exe_state=0
    fi
    
    if [ "${exe_state}x" != "0x" ]
    then
        f_logging "$(eval echo ${log_addr}):ERROR" "从 '${src_host}:/${server_sql_file}'拉sql文件失败"|tee -a ${log_file}
        return 1
    fi
    return 0
}

